package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<b>
 *<li>Rule 4:  BasicRuleSemantics ::= def rule MODE { RuleSemanticsBody }
 *</b>
 */
public class BasicRuleSemantics extends Ast implements IBasicRuleSemantics
{
    private IMODE _MODE;
    private IRuleSemanticsBody _RuleSemanticsBody;

    public IMODE getMODE() { return _MODE; }
    public IRuleSemanticsBody getRuleSemanticsBody() { return _RuleSemanticsBody; }

    public BasicRuleSemantics(IToken leftIToken, IToken rightIToken,
                              IMODE _MODE,
                              IRuleSemanticsBody _RuleSemanticsBody)
    {
        super(leftIToken, rightIToken);

        this._MODE = _MODE;
        this._RuleSemanticsBody = _RuleSemanticsBody;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof BasicRuleSemantics)) return false;
        if (! super.equals(o)) return false;
        BasicRuleSemantics other = (BasicRuleSemantics) o;
        if (! _MODE.equals(other._MODE)) return false;
        if (! _RuleSemanticsBody.equals(other._RuleSemanticsBody)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_MODE.hashCode());
        hash = hash * 31 + (_RuleSemanticsBody.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


